Estimation of length using python in QGIS